package com.gwz.cardserver.logic;

import com.gwz.cardserver.consts.ChatCodeConst;
import com.gwz.cardserver.dto.ReqBase;
import com.gwz.cardserver.service.ChatService;
import io.netty.channel.ChannelHandlerContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ChatHandler implements IHandler{
    @Autowired
    private ChatService chatService;
    @Override
    public void channelRead(ChannelHandlerContext ctx, ReqBase reqBase) {
        switch (reqBase.getSubCode()) {
            case ChatCodeConst.DEFAULT: {
                chatService.chatRequest(ctx,reqBase);
                break;
            }

        }
    }

    @Override
    public void channelActive(ChannelHandlerContext ctx) {

    }

    @Override
    public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {

    }
}
